package controllers;

import models.LexiconModel;
import views.ViewLexicon;
import controllers.listeners.lexicon.AddFeatureActionListener;
import controllers.listeners.lexicon.AddFormActionListener;
import controllers.listeners.lexicon.AddLexiconActionListener;
import controllers.listeners.lexicon.AddSyntacticListener;
import controllers.listeners.lexicon.LoadConceptSenseItemListener;
import controllers.listeners.lexicon.LoadSyntacticCategoryActionListener;
import controllers.listeners.lexicon.OpenLexiconListener;
import controllers.listeners.lexicon.LexiconTableListener;
import controllers.listeners.lexicon.SaveLexiconListener;
import controllers.listeners.lexicon.ViewsButtonActionListener;

/* Initializes Lexicon UI and listeners */
public class LexiconModuleController {
	
	public ViewLexicon view;
	
	public LexiconModuleController(){
		/* Initialize view */
		view = new ViewLexicon();
		view.setLexicon(LexiconModel.getLexicon());
		
		/** Initialize listeners **/
		
		OpenLexiconListener openLexiconListener = new OpenLexiconListener();
		SaveLexiconListener saveLexiconListener = new SaveLexiconListener();
		LoadSyntacticCategoryActionListener loadCategoryListener = new LoadSyntacticCategoryActionListener();
		AddSyntacticListener addSyntacticListener = new AddSyntacticListener();
		ViewsButtonActionListener viewsButtonListener = new ViewsButtonActionListener();
		AddLexiconActionListener addLexiconListener = new AddLexiconActionListener();
		AddFeatureActionListener addFeatureListener = new AddFeatureActionListener();
		AddFormActionListener addFormListener = new AddFormActionListener();
		LexiconTableListener tableListener = new LexiconTableListener();
		LoadConceptSenseItemListener conceptSenseListener = new LoadConceptSenseItemListener();
		
		openLexiconListener.setView(view);
		loadCategoryListener.setView(view);
		addSyntacticListener.setView(view);
		viewsButtonListener.setView(view);
		addLexiconListener.setView(view);
		addFeatureListener.setView(view);
		addFormListener.setView(view);
		tableListener.setView(view);
		conceptSenseListener.setView(view);
		
		view.addLoadLexiconActionListener(openLexiconListener);
		view.addSaveLexiconActionListener(saveLexiconListener);
		view.addLoadSyntacticCategoryListener(loadCategoryListener);
		view.addSyntacticListener(addSyntacticListener);
		view.addViewsButtonsListener(viewsButtonListener);
		view.addLexiconListener(addLexiconListener);
		view.addFeatureListener(addFeatureListener);
		view.addFormListener(addFormListener);
		view.addTableListener(tableListener);
		view.addLoadConceptSenseListener(conceptSenseListener);
		
		/* Set UI visible */
		view.setVisible(true);
	}

}
